package com.teradata.dashboard.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

public class CustomDialog extends Dialog {
    
    public static final int DEFAULT_WIDTH = 160; //默认宽度
    public static final int DEFAULT_HEIGHT = 160;//默认高度
    
    public CustomDialog(Context context, int layout, int style) {
        this(context, DEFAULT_WIDTH, DEFAULT_HEIGHT, layout, style);
    }
    
    public CustomDialog(Context context, int width, int height, int layout, int style) {
        super(context, style);
        
        //set content
        setContentView(layout);
        
        //set window params
        Window window = getWindow();
        WindowManager.LayoutParams params = window.getAttributes();
        
        //set width,height,gravity
        params.width = width;
        params.height = height;
        params.gravity = Gravity.CENTER;
        
        
        window.setAttributes(params);
    }
}